<template>
  <van-nav-bar title="隐私协议" />

  <van-cell
    v-for="(item, index) in nameList"
    :key="index"
    :title="item.agreementName"
    is-link
    @click="toInfo(item.agreementName)"
  />
</template>
<script setup lang="ts" name="home">
import { getName } from "@/api";

import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();

const nameList = ref([]);

onMounted(() => {
  GetPNameList();
});

const GetPNameList = async () => {
  let data = await getName();
  nameList.value = data;
  console.log(data);
};

const toInfo = (name: string) => {
  router.push(`/info?name=${name}`);
};
</script>
